<template>
	<view class="mainpadding2" style="padding-bottom: 150rpx;">
		<view class="flexcolumn" v-if="list.data.length==0">
			<view class="placeholderimage" style="margin-top: 200rpx;"></view>
			<view class="xiaohei textcenter ershil">暂无数据</view>
		</view>
		<view v-else>
			<view class="mainpadding_top ffffff radius" @click="jumpdetail('/pages/mine/hexiao?id=',item.id)" v-for="item in list.data" :key="item.id">
				<view class="xiaolan sanshier">{{item.tourist_name}}</view>
				<view class="flexbetween margin_top">
					<view class="xiaohei fonweight ershiba">{{item.cc_time_text}} {{item.tourist_time_name}}出发</view>
					<view class="xiaolv ershil" v-if="item.state==3">已核销</view>
				</view>
				<view class="xiahuaxian">
					<view class="margin_top">
						<text class="lvdian margin_right2"></text>
						<text class="xiaohui ershiba ">{{item.start_tourist_site_name}}</text>
					</view>
					<view class="margin_top">
						<text class="huangdian margin_right2"></text>
						<text class="xiaohui ershiba ">{{item.end_tourist_site_name}}</text>
					</view>
				</view>
				<view class="xiaohei margin_top fonweight ershil">{{item.order_no}}</view>
			</view>
		</view>
		<view class="mainpadding ffffff gudingdb">
			<view class="bigbtn" @click="scanbarCode">扫码核销</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			scanbarCode() {
				let that = this
				uni.scanCode({
					success: function (res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						uni.navigateTo({
							url:"/pages/mine/hexiao?id="+res.result
						})
					}
				});
			
			},
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/Travelcl/getHxOrderlist', 'GET', {
					page: page || 1,
					limit: 12,
					// 0=全部，1=待支付,2=待乘车,3=已完成,4=取消审核中,5=已取消
					state: this.tabsid
				}).then(res => {
					uni.stopPullDownRefresh()
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
